import request from '@/utils/request'
// 获取所有的角色列表
export const getRoleListApi = () => request('/roles', 'get')
// 根据角色id和权限id删除角色的权限
export const removeRightByIdApi = (roleId, rightsId) => request(`/roles/${roleId}/rights/${rightsId}`, 'delete')
// 根据角色id删除角色
export const deleteRoleApi = id => request(`/roles/${id}`, 'delete')
// 添加角色
export const addRoleApi = roleInfo => request('/roles', 'post', roleInfo)

// 根据角色id获取角色信息
export const getRoleInfoByIdApi = id => request(`/roles/${id}`, 'get')
// 编辑角色
export const editRoleApi = roleInfo => request(`/roles/${roleInfo.roleId}`, 'put', roleInfo)

// 给角色授权
export const setRoleRightApi = (roleId, rids) => request(`/roles/${roleId}/rights`, 'post', {rids})

